/**
 * Copyright (c) 2010 Moogene
 * All rights reserved
 *
 * This software is the confidential and proprietary information of Moogene.
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into
 * with Moogene
 */
package com.moogene.android.engine.action;

/**
 * @author Song, jiawei
 *
 */
public class ActionMonitorProxy implements ActionMonitor{
	private static ActionMonitorProxy sActMonitor;
	
	private KeyAnalyse sKeyAnalyse;
	private ActTouchEvent sActTouchEvent;
	
	private ActionMonitorProxy(){
		sKeyAnalyse = KeyAnalyse.getInstance();
		sActTouchEvent = ActTouchEvent.getInstance();
	}
	
	static ActionMonitor getInstance(){
		if(sActMonitor == null){
			sActMonitor = new ActionMonitorProxy();
		}
		return sActMonitor;
	}
	
	@Override
	public boolean isAnyKeyHold() {
		return sKeyAnalyse.isAnyKeyHold();
	}

	@Override
	public boolean isAnyKeyPressed() {
		return sKeyAnalyse.isAnyKeyPressed();
	}

	@Override
	public boolean isKeyDoublePressed(int gameKey) {
		return sKeyAnalyse.isKeyDoublePressed(gameKey);
	}

	@Override
	public boolean isKeyHold(int gameKey) {
		return sKeyAnalyse.isKeyHold(gameKey);
	}

	@Override
	public boolean isKeyPressed(int gameKey) {
		return sKeyAnalyse.isKeyPressed(gameKey);
	}

	@Override
	public boolean isKeyReleased(int gameKey) {
		return sKeyAnalyse.isKeyReleased(gameKey);
	}

	@Override
	public boolean isTouchDetected(int actionType) {
		if(sActTouchEvent.getType() == actionType){
			return true;
		}
		return false;
	}
	
	@Override
	public ActTouchEvent getActTouchEvent() {
		return sActTouchEvent;
	}


}
